package com.qiyu.tech.design.starter;

/**
 * 快速失败组件设计
 *
 * @Author linhao
 * @Date created in 6:27 下午 2021/1/13
 */
public abstract class FastFailHandler extends AbstractProtectHandler{

    public FastFailHandler(Object target) {
        super(target);
    }

    public Object doCoreMethod(Object object){
        try {
            return doTargetCoreMethod(object);
        }catch ( Exception e ){
            e.printStackTrace();
            this.doHandleAfterMethodFail();
        }
        return null;
    }

    @Override
    public Object doHandleAfterMethodFail() {
        return "方法执行失败了，快速失败";
    }
}
